<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";%>
<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <style>
        span {
            color: red;
        }
    </style>
    <script src="/js/jquery.min.js"></script>
    <script>
        $(function () {
            $("#goback").click(function () {
                window.history.back();
            });
        });
    </script>
</head>
<body>
<jsp:include page="/admin/top.jsp"/>
<form name="form" action="admin/useredit" method="post">
    <div class="middle">
        <table class="zbox">
            <tr>
                <td width="10%">用户名</td>
                <td>
                    <input type="text" value="${user.userid }" disabled>
                    <input name="userid" type="hidden" value="${user.userid }">
                    <span>*</span>
                </td>
            </tr>
            <tr>
                <td width="10%">姓名</td>
                <td><input name="username" type="text" value="${user.username }" required>
                    <span>*</span>
                </td>
            </tr>
            <tr>
                <td width="10%">密码</td>
                <td><input name="password" type="text" value="${user.password }" required>
                    <span>*</span>
                </td>
            </tr>
            <tr>
                <td width="10%">性别</td>
                <td>
                    <select name="gender">
                        <option value="男" ${user.gender=='男' ? 'selected':'' } >男</option>
                        <option value="女" ${user.gender=='女' ? 'selected':'' } >女</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="10%">联系地址</td>
                <td><input name="address" type="text" value="${user.address }"></td>
            </tr>
            <tr>
                <td width="10%">E-mail</td>
                <td><input name="email" type="email" value="${user.email }"></td>
            </tr>
            <tr>
                <td width="10%">电话</td>
                <td><input name="phone" type="tel" pattern="[0-9]{11}" value="${user.phone }"></td>
            </tr>
            <tr>
                <td width="10%">邮编</td>
                <td><input name="postcode" type="text" pattern="[0-9]{3,6}"
                           value="${user.postcode }"></td>
            </tr>
            <tr>
                <td width="10%">状态</td>
                <td>
                    <select name="state">
                        <option value='1' ${ '1' == user.state ? 'selected':'' }>激活</option>
                        <option value='0' ${ '0' == user.state ? 'selected':'' }>未激活</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" value="更新">&nbsp;&nbsp;
                    <input type="reset" value="重置">&nbsp;&nbsp;
                    <input id="goback" type="button" value="返回">
                </td>
            </tr>
        </table>
    </div>
</form>
<jsp:include page="/admin/bottom.jsp"/>
</body>
</html>